//
//  SEGTarget_MenuList.m
//  SEGUhomeStandard
//
//  Created by 刘山 on 2018/4/9.
//  Copyright © 2018年 刘山. All rights reserved.
//

#import "SEGTarget_MenuList.h"
#import "SEGMenuListViewController.h"
#import "SEGMyRootViewController.h"
#import "SEGServiceViewController.h"
#import "SEGMainViewController.h"
#import "SEGMenuChildListViewController.h"
#import "SEGOldPGCViewController.h"
#import "SEGMenuCommunityViewController.h"

@implementation SEGTarget_MenuList
/**
 * 菜单界面
 * @author Sam
 */
-(UIViewController*)segAction_initMenuListViewController:(NSDictionary*)params{
    SEGMenuListViewController *VC = [[SEGMenuListViewController alloc]init];
    VC.menuSid = [params valueForKey:@"menuSid"];
    VC.action = [params valueForKey:@"action"];
    VC.settingsId = [params valueForKey:@"settingsId"];
    return VC;
}

/**
 * 菜单界面-我的
 * @author Sam
 */
-(UIViewController*)segAction_initMyRootViewController:(NSDictionary*)params{
    SEGMyRootViewController *VC = [[SEGMyRootViewController alloc]init];
    VC.menuSid = [params valueForKey:@"menuSid"];
    VC.action = [params valueForKey:@"action"];
    VC.settingsId = [params valueForKey:@"settingsId"];
    return VC;
}

/**
 * 菜单界面-服务
 * @author Sam
 */
-(UIViewController*)segAction_initServiceViewController:(NSDictionary*)params{
    SEGServiceViewController *VC = [[SEGServiceViewController alloc]init];
    VC.menuSid = [params valueForKey:@"menuSid"];
    VC.action = [params valueForKey:@"action"];
    VC.settingsId = [params valueForKey:@"settingsId"];
    return VC;
}

/**
 * 菜单界面-
 * @author Sam
 */
-(UIViewController*)segAction_initOldPGCViewController:(NSDictionary*)params{
    SEGOldPGCViewController *VC = [[SEGOldPGCViewController alloc]init];
    VC.quizTypeId = [params valueForKey:@"quizTypeId"];
    VC.forwordVC = [params valueForKey:@"forwordVC"];
    VC.isRecommend = [params valueForKey:@"isRecommend"];
    return VC;
}

/**
 * 菜单界面-纷享
 * @author Sam
 */
-(UIViewController*)segAction_initMainViewController:(NSDictionary*)params{
    SEGMainViewController *VC = [[SEGMainViewController alloc]init];
    VC.menuSid = [params valueForKey:@"menuSid"];
    VC.action = [params valueForKey:@"action"];
    VC.settingsId = [params valueForKey:@"settingsId"];
    return VC;
}

/**
 * 菜单界面-子菜单界面
 * @author Sam
 */
-(UIViewController*)segAction_initMenuChildListViewController:(NSDictionary*)params{
    SEGMenuChildListViewController *VC = [[SEGMenuChildListViewController alloc]init];
    NSArray *data = [params valueForKey:@"childList"];
    if (![data isKindOfClass:[NSArray class]]) return nil;
    NSMutableArray *arrM = [NSMutableArray array];
    [data enumerateObjectsUsingBlock:^(NSDictionary*  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        SEGMenuListModel *tmp = [SEGMenuListModel yy_modelWithDictionary:obj];
        tmp.widgetType = @(SEGEnumShowTypeThreeColumsSpread).stringValue;
        [arrM addObject:tmp];
    }];
    VC.title = [[params allKeys]containsObject:@"serviceName"] ? [params valueForKey:@"serviceName"] : @"";
    VC.dataSource = [NSArray arrayWithArray:arrM];
    return VC;
}

/**
 * 菜单界面-社区
 * 2018-05-28
 * @author Sam
 */
- (UIViewController *)segAction_initMenuCommunityViewController:(NSDictionary *)params {
    SEGMenuCommunityViewController *VC = [[SEGMenuCommunityViewController alloc] init];
    VC.menuSid = [params valueForKey:@"menuSid"];
    VC.action = [params valueForKey:@"action"];
    VC.settingsId = [params valueForKey:@"settingsId"];
    return VC;
}

@end
